package com.headfirst.StructuralMode.decorator.version1.coffee;

import com.headfirst.StructuralMode.decorator.version1.Beverage;

/**
 * 低咖啡因,是一种具体的饮料,继承了抽象的饮料类Beverage
 * @author sunhongguang
 * @create 2022-01-22-20:58
 */
public class Decaf extends Beverage {
    public Decaf() {
        super.setDescription(super.getSize()+" Decaf");
    }

    public Decaf(String size) {
        super.setSize(size);
        super.setDescription(size+" Decaf");
    }

    @Override
    public double cost() {
        double price = 0;
        switch (super.getSize()){
            case "小杯":
                price = 1.05;
                break;
            case "中杯":
                price = 1.25;
                break;
            case "大杯":
                price = 1.45;
                break;
            case "超大杯":
                price = 1.65;
                break;
        }
        return price;
    }
}
